package com.kingzoon.seckill.web;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

import java.util.HashMap;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.kingzoon.seckill.dto.Result;
import com.kingzoon.seckill.enums.MacroDefine;
import com.kingzoon.seckill.service.OpenAcctDepositService;

@Controller
@Api(value = "开户绑卡", description = "开户绑卡")
public class OpenAcctDepositController {
	
	@Autowired
	private OpenAcctDepositService openAcctDepositService;
	
	@ApiOperation(value = "用户绑卡")
	@RequestMapping(value="/account/deposit",method=RequestMethod.POST,produces={"application/json;charset=utf-8"})
	@ResponseBody
	public Result<HashMap<String,Object>> login(
			@ApiParam(required = true, value = "平台号")@RequestParam("exchangeId")String exchangeId,
			@ApiParam(required = true, value = "商户号")@RequestParam("distributorId")String distributorId,
			@ApiParam(required = true, value = "会员编号")@RequestParam("memberId")String memberId,
			@ApiParam(required = true, value = "渠道类型")@RequestParam("channelType")String channelType,
			@ApiParam(required = true, value = "短信验证码")@RequestParam("smsCode")String smsCode,
			@ApiParam(required = true, value = "银行编号")@RequestParam("bankNo")String bankNo,
			@ApiParam(required = true, value = "银行账号")@RequestParam("bankAcc")String bankAcc,
			@ApiParam(required = true, value = "绑卡模式")@RequestParam("bindMode")String bindMode){
		Result<HashMap<String,Object>> rs = new Result<HashMap<String,Object>>(false, MacroDefine.JC_CODE.R_9999.getCode(), MacroDefine.JC_CODE.R_9999.getMessage());
		try {
			HashMap<String,Object> mapParam = new HashMap<String,Object>();
			mapParam.put("exchangeId", exchangeId);
			mapParam.put("distributorId", distributorId);
			mapParam.put("memberId", memberId);
			mapParam.put("channelType", channelType);
			mapParam.put("smsCode", smsCode);
			mapParam.put("bankNo", bankNo);
			mapParam.put("bankAcc", bankAcc);
			mapParam.put("bindMode", bindMode);
			rs = openAcctDepositService.doBusiness(mapParam, rs);
			return rs;
		}
		catch (Exception e) {
			e.printStackTrace();
			return rs;
		}
	}

}
